package com.sop.dao.impl;

import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import com.sop.dao.RoleDao;
import com.sop.model.RoleInfo;
import com.sop.model.vo.RoleInfoVo;
import common.base.dao.IBaseDaoImpl;
import common.tools.StringTool;

@Repository("roleDao")
public class RoleDaoImpl extends IBaseDaoImpl<RoleInfo,RoleInfoVo> implements RoleDao{

	@Override
	public Criteria getSearchCriteria(Session session, RoleInfoVo searchVo) {
		 Criteria c = session.createCriteria(RoleInfo.class);  
         
	        if(searchVo.getRoleInfo()!=null){
	        //检索条件  
	            String name =  searchVo.getRoleInfo().getName();  
	            if (StringTool.isStringAvaliable(name)) {  
	                c.add(Restrictions.ilike("name", "%" + name + "%"));  
	            }  
	        }   
	        return c;
	}

	
}
